<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>原型</title>
</head>
<body>
    <script>
        class People{
            constructor(name){
                this.name = name;
            }
            intro(){
                console.log("hello");
            }
        }
        function ChinesePeople(){

        }
        People.prototype.age = 30;
        
        let p = new People("张飞");
        let p1 = new People("关羽");
        ChinesePeople.prototype = new People();
        let cp = new ChinesePeople();
        
        console.log(p.age);
        console.log(p1.age);
        console.log(cp.intro());

        console.log("p.__proto__：",p.__proto__);
        console.log("p.constructor：",p.constructor);
        console.log("People.prototype：",People.prototype);
        console.log("p.constructor.prototype：",p.constructor.prototype);
        // 获取根对象
        console.log("p.__proto__.__proto__：",p.__proto__.__proto__);
    </script>
</body>
</html>